import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_fun_zjversion/config/resource_manager.dart';

class BannerImage extends StatelessWidget {
  final String url;
  final BoxFit fit;

  BannerImage(this.url, {this.fit=BoxFit.fill});

  @override
  Widget build(BuildContext context) {
    return new CachedNetworkImage(
      imageUrl: ImageHelper.wrapUrl(url),
      placeholder: (ctx,url)=> Center(child: CupertinoActivityIndicator(),),
      errorWidget: (ctx,url,error)=> Icon(Icons.error),
      fit: fit,
    );
  }
}